import { RouteRecordRaw } from "vue-router";
import { HOME_URL, LOGIN_URL, INDEX_URL } from "@/config";

/**
 * staticRouter(静态路由)
 */
export const staticRouter: RouteRecordRaw[] = [
	{
		path: "/",
		redirect: HOME_URL
	},
	{
		path: LOGIN_URL,
		name: "login",
		component: () => import("@/views/login/index.vue"),
		meta: {
			title: "登录"
		}
	},
	{
		path: INDEX_URL,
		name: "index",
		component: () => import("@/views/index/index.vue"),
		meta: {
			title: "首页"
		}
	},
	{
		path: "/layout",
		name: "layout",
		component: () => import("@/layouts/index.vue"),
		redirect: HOME_URL,
		children: []
	}
];

/**
 * errorRouter(错误页面路由)
 */
export const errorRouter: RouteRecordRaw[] = [
	{
		path: "/403",
		name: "403",
		component: () => import("@/components/ErrorMessage/403.vue"),
		meta: {
			title: "403页面"
		}
	},
	{
		path: "/404",
		name: "404",
		component: () => import("@/components/ErrorMessage/404.vue"),
		meta: {
			title: "404页面"
		}
	},
	{
		path: "/500",
		name: "500",
		component: () => import("@/components/ErrorMessage/500.vue"),
		meta: {
			title: "500页面"
		}
	},
	// 解决刷新页面，路由警告
	{
		path: "/:pathMatch(.*)*",
		component: () => import("@/components/ErrorMessage/404.vue")
	}
];

/**
 * textRouter (静态二级路由)
 */
export const textRouter = [
	{
		path: "/hiprint",
		name: "hiprint",
		component: "/hiprint/index",
		meta: {
			icon: "ProjectOutlined",
			title: "打印页面",
			isHide: false,
			isAffix: false,
			isFull: false,
			isKeepAlive: true,
			isLink: ""
		}
	},
	{
		path: "/text",
		name: "text",
		component: "/text/index",
		meta: {
			icon: "ProjectOutlined",
			title: "打印页面1",
			isHide: false,
			isAffix: false,
			isFull: false,
			isKeepAlive: true,
			isLink: ""
		}
	},
	{
		meta: {
			icon: "TableOutlined",
			isAffix: false,
			isFull: false,
			isHide: false,
			isKeepAlive: true,
			isLink: "",
			title: "超级表格2"
		},
		name: "proTable",
		path: "/proTable",
		redirect: "/proTable/useProTable",
		children: [
			{
				meta: {
					icon: "InsertRowAboveOutlined",
					isAffix: false,
					isFull: false,
					isHide: false,
					isKeepAlive: true,
					isLink: "",
					title: "简单表格"
				},
				name: "useProTable",
				path: "/proTable/useProTable",
				component: "/proTable/useProTable/index",
				children: [
					{
						name: "useProTableDetail",
						path: "/proTable/useProTable/detail/:id",
						component: "/proTable/useProTable/detail",
						meta: {
							activeMenu: "/proTable/useProTable",
							icon: "FileTextOutlined",
							isAffix: false,
							isFull: false,
							isHide: true,
							isKeepAlive: true,
							isLink: "",
							title: "用户详情"
						}
					}
				]
			}
		]
	}
];
